package com.irdstudio.tdp.console.api.rest;

import java.util.List;

import com.irdstudio.sdk.beans.core.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.irdstudio.tdp.console.service.facade.OsrvValidateInfoService;
import com.irdstudio.tdp.console.service.vo.OsrvValidateInfoVO;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.beans.web.controller.AbstractController;

@RestController
@RequestMapping("/api")
public class OsrvValidateInfoController extends AbstractController  {
	
	@Autowired
	@Qualifier("osrvValidateInfoServiceImpl")
	private OsrvValidateInfoService osrvValidateInfoService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/osrv/validate/infos", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<OsrvValidateInfoVO>> queryOsrvValidateInfoAll(
			OsrvValidateInfoVO vo) {		
		List<OsrvValidateInfoVO> outputVo = osrvValidateInfoService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/osrv/validate/info/{recordKeyid}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<OsrvValidateInfoVO> queryByPk(@PathVariable("recordKeyid") String recordKeyid) {		
		OsrvValidateInfoVO inVo = new OsrvValidateInfoVO();
				inVo.setRecordKeyid(recordKeyid);
		OsrvValidateInfoVO outputVo = osrvValidateInfoService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param osrvValidateInfo
	 * @return
	 */
	@RequestMapping(value="/osrv/validate/info", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody OsrvValidateInfoVO inOsrvValidateInfoVo) {		
		int outputVo = osrvValidateInfoService.deleteByPk(inOsrvValidateInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inOsrvValidateInfoVo
	 * @return
	 */
	@RequestMapping(value="/osrv/validate/info", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody OsrvValidateInfoVO inOsrvValidateInfoVo) {		
		int outputVo = osrvValidateInfoService.updateByPk(inOsrvValidateInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inOsrvValidateInfoVo
	 * @return
	 */
	@RequestMapping(value="/osrv/validate/info", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertOsrvValidateInfo(@RequestBody OsrvValidateInfoVO inOsrvValidateInfoVo) {
		inOsrvValidateInfoVo.setRecordKeyid(UUIDUtil.getUUID());
		int outputVo = osrvValidateInfoService.insertOsrvValidateInfo(inOsrvValidateInfoVo);
		return getResponseData(outputVo);
		
	}
}
